#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
	int client_fd;
	int addr_len;
	struct sockaddr_un addr;
	char ch='A';

	addr_len=sizeof(addr);
	addr.sun_family=AF_UNIX;
	strcpy(addr.sun_path,"socket_server");
	client_fd=socket(AF_UNIX,SOCK_STREAM,0);
	
	if(connect(client_fd,(struct sockaddr*)&addr,addr_len)==-1)
	{
		printf("connect error");
		return -1;
	}
	
	write(client_fd,&ch,1);
	read(client_fd,&ch,1);
	printf("from server:%c",ch);
	close(client_fd);
	return 0;
}
